/*
ndk-build
gcc -c windows.c -o test.o
gcc -shared  test.o -lFlashRuntimeExtensions -o my.dll
del test.o
*/
#include"FlashRuntimeExtensions.h"
#include <stdlib.h>
#include <string.h>

FREObject test(FREContext ctx,void*funcData,uint32_t argc,FREObject argv[])
{       
        const uint8_t* msg = (const uint8_t*)"Hello world xxx";
        FREObject retObj;
        FRENewObjectFromUTF8(strlen((const char*)msg)+1, msg, &retObj);
        return retObj;
}
void ContextInitializer(void* extData, const uint8_t* ctxType,FREContext ctx,uint32_t* numFunctionsToTest,const FRENamedFunction** functionsToSet)
{
        *numFunctionsToTest= 1;
        FRENamedFunction*func = (FRENamedFunction*)malloc(sizeof(FRENamedFunction)*1);
        func[0].name= (const uint8_t*)"test";
        func[0].functionData= NULL;
        func[0].function= &test;
        *functionsToSet= func;
}

void ContextFinalizer(FREContext ctx) {}
void ExtInitializer(void** extDataToSet, FREContextInitializer* ctxInitializerToSet,FREContextFinalizer* ctxFinalizerToSet){
        *extDataToSet= NULL;
        *ctxInitializerToSet= ContextInitializer;
        *ctxFinalizerToSet= ContextFinalizer;
}
void ExtFinalizer(void* extData){}

